<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: lipengyu
  Date: 2022/11/12
  Time: 20:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>分页显示所有车辆信息</title>
</head>
<body>
<h1>所有车辆信息</h1>
<c:forEach var="car" items="${pageInfo.records}">
    车辆ID:${car.carId}
    车辆名称：${car.carName}
    车辆品牌：${car.carBrand}
    日租价格：${car.carPrice}
    <a href="${pageContext.request.contextPath}/car/${car.carId}">修改</a>
    <form action="${pageContext.request.contextPath}/car" method="post">
        <input type="hidden" name="_method" value="delete">
        <input type="hidden" name="carId" value="${car.carId}">
        <input type="submit" value="删除">
    </form>
    <br>
</c:forEach>
<c:if test="${pageInfo.current!=1}">
    <a href="${pageContext.request.contextPath}/car/page/${pageInfo.current-1}">上一页</a>
</c:if>

当前${pageInfo.current}页
总计${pageInfo.pages}页

<c:if test="${pageInfo.current!=pageInfo.pages}">
    <a href="${pageContext.request.contextPath}/car/page/${pageInfo.current+1}">下一页</a>
</c:if>
</body>
</html>
